﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeLinearScale : DataGaugeBase
    {
        public DataGaugeLinearScale()
        {
            LinearStartMargin = 0.02;
            LinearEndMargin = 0.02;

            LinearMaximum = 120;

            GaugeOuterBackground = new BrushEx(new SolidColorBrush(Colors.Transparent));
        }

        protected override void OnApplyXProperty()
        {
            base.OnApplyXProperty();

            Gauge gauge = GetGauge();
            if (gauge != null)
            {
                gauge.LinearScales.Clear();
                LinearScale linearScale = new LinearScale();
                SetLinearScale(linearScale);
                linearScale.MajorTicks = GetMajorTicks();
                linearScale.MinorTicks = GetMinorTicks();
                linearScale.ScaleLabels = GetScaleLabels();
                gauge.LinearScales.Add(linearScale);
            }
        }

        internal override IndicatorTypes GetIndicatorType(string dataSeriesName)
        {
            if (IndicatorsType != null && IndicatorsType.ContainsKey(dataSeriesName))
            {
                switch (IndicatorsType[dataSeriesName].ToUpper())
                {
                    case "NEEDLE": return IndicatorTypes.Needle;
                    case "BAR": return IndicatorTypes.Bar;
                    case "MARKER": return IndicatorTypes.Marker;
                }
            }
            return IndicatorTypes.Bar;
        }
    }
}
